package com.ynyr.jar.weixin.config;

import com.ynyr.jar.common.jpa.db.DataSourceBuilder;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.core.env.Environment;

import javax.sql.DataSource;
import java.sql.SQLException;

@Configuration
public class DbConfig {

    @Autowired
    private Environment environment;

    @Bean
    public DataSource dataSource() throws SQLException {
        return DataSourceBuilder.build(environment, "spring.datasource");
    }

}
